// Copyright 2008 Senary
// See credits.txt for details.

// This file is part of Omega VII.

// Omega VII is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.

// Omega VII is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.

// You should have received a copy of the GNU General Public License
// along with Omega VII.  If not, see <http://www.gnu.org/licenses/>.

#pragma once

#include <windows.h> //required by adll.h
#include "sdk_engine/adll.h"

#include "Vector.h"

class InputManager
{
private:
	// sound links
	SOUND* affirmative;
	SOUND* gogogo;
	SOUND* notagain;
	SOUND* showtime;
	//handler for mouse clicks: the first is just a static function because methods don't work...
	static void mousePressed(var code);
	void onMousePressed(var code);
	void onMouseReleased();

	// Position where the mouse was pressed
	Vector _mousePressPos;
	// Is the mouse button pressed? Used to detect button release
	bool _isMousePressed;

	SpaceObject* objectAtPos(Vector const& pos) const;

	// Vector of all buttons
	std::vector<Button*> _buttons;

	//when mouse hover over button, show tool tip text
	void showToolTipText(void);
public:
	InputManager(void);
	~InputManager(void);

	//register all event hadler
	void initEventHandling(void);

	// Updates mouse status etc
	void update(float timestep, float totalTime);

	// adds a button to the button vector
	void registerButton(Button* b);

	//update camera position when mouse pointer near screen edge
	void updateCamera(float timestep, float totalTime);
};
